$('.submit').on('tap', function () {
	if(!userInfo.user_realname || !userInfo.mobile) {
		return mui.alert('请完善个人信息后申请', '温馨提示', '去完善', function () {
			location.href = '../user/edit.html';
		});
	}

   var map = new AMap.Map('container');
	Geolocation(map);
});
function Geolocation(map) {
	map.plugin('AMap.Geolocation', function() {
		geolocation = new AMap.Geolocation({
			enableHighAccuracy: true, //是否使用高精度定位，默认:true
			timeout: 10000, //超过10秒后停止定位，默认：无穷大
			buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
			zoomToAccuracy: false, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
			buttonPosition: 'RB'
		});
		map.addControl(geolocation);
		geolocation.getCurrentPosition();
		AMap.event.addListener(geolocation, 'complete', function(data) {
			console.log(data);
			baseApi.post(
			    'service/rescue',
			    {
			        longitude: data.position.getLng(),
			        latitude: data.position.getLat(),
			    },
			    function (result) {
			        mui.toast(result);
			    }
			);
		});
		AMap.event.addListener(geolocation, 'error', function(e) {
			console.log("error" + e.message);
		});
	});
}
